
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<%include("/common/include.html"){}%>
		<style type="text/css">
			
		</style>
	</head>
		<body style="overflow-x:hidden">
		<form id="zxcsform" action="${cxt !}/collection/measurement/cesuan" method="post">
		<div style="width: 90%">
			<%include("/collection/servicePart/collectionSearchCustomer.html"){}%>
		</div>
		
		<div  id="mbtablediv" class="easyui-panel"  style="height:auto;padding:5px;margin-top: 15px" align="center" >
				<table   id="mbtable" border="1"  bordercolor="#DDDDDD" style="width:100%;height:85%; text-align: center;font-size: 15px;">
										<tr style="font-weight: bold;">
										<td rowspan="2" style="width:5%;">体重</td>
										
										<!-- <td colspan="3" >减重情况</td> -->
										<td rowspan="2" style="width:8%;height: 30px;">手法</td>
										<!-- <td colspan="8" >精护部位</td> -->
										<%if(partnum == 8){%>
										<td colspan="8" >精护部位</td>
										<%}else if(partnum == 7){%>
										<td colspan="7" >精护部位</td>
										<%}else if(partnum == 5){%>
										<td colspan="5" >精护部位</td>
										<%}else if(partnum == 4){%>
										<td colspan="4" >精护部位</td>
										<%}else{%>
										<td colspan="6" >精护部位</td>
										<%}%>
										<td rowspan="2">备注</td>
										</tr>
										
										<tr >
										<!-- <td style="width:5%;height: 30px;">涨称</td>
										<td style="width:5%;height: 30px;">掉称</td>
										<td style="width:5%;height: 30px;">平称</td> -->
										<td style="width:5%;height: 30px;">腰部</td>
										<td style="width:5%;height: 30px;">大腿</td>
										<td style="width:5%;height: 30px;">小腿</td>
										<td style="width:5%;height: 30px;">胳膊</td>
										<%if(bbExp=='1'){%>
												<td style="width:8%;height: 30px;">背部</td>
										<%}%>
										<%if(kbExp=='1'){%>
										<td style="width:8%;height: 30px;">胯部</td>
										<%}%>
										<%if(Exp=='1'){%>
										<td style="width:8%;height: 30px;">左副乳</td>
										<td style="width:8%;height: 30px;">右副乳</td>
										<%}%>
										<!-- <td style="width:5%;height: 30px;">背部</td>
										<td style="width:5%;height: 30px;">胯部</td>
										<td style="width:5%;height: 30px;">左副乳</td>
										<td style="width:5%;height: 30px;">右副乳</td> -->
										</tr>
										
										
										<tr style="font-weight: bold;">
										<td  style="width:5%;">
											<input class="easyui-validatebox"  name="customerService.weight" value="${customerService.weight!}"  id="weight" style="width: 90%;height: 30px;margin: 0px;padding: 0px;border-radius:3px;  border: 1px solid #ff7e00; "  >
										</td>
										
										<!-- <td id="zc">
										</td>
										<td  id="dc">
										
										</td>
										<td >
										</td> -->
										<td  style="width:5%;height: 30px;">
										<#organization type="select" id="sf" name="sf"   organization="${organids! }" defaultCode="${customerService.plasterservier!}"   class="easyui-combobox inputBox theme-textbox-radius" />
										</td>
										<td style="width:8%;height: 30px;">
										<#organization type="select" id="yb"  name="yb"  organization="${organids! }" defaultCode="${customerService.yb!}"   class="easyui-combobox inputBox theme-textbox-radius" />
										</td>
										<td style="width:8%;height: 30px;">
										<#organization type="select" id="dt"  name="dt"   organization="${organids! }" defaultCode="${customerService.dt!}"   class="easyui-combobox inputBox theme-textbox-radius" />
										<td style="width:8%;height: 30px;">
										<#organization type="select" id="xt"   name="xt"   organization="${organids! }" defaultCode="${customerService.xt!}"   class="easyui-combobox inputBox theme-textbox-radius" />
										</td>
										<td style="width:8%;height: 30px;">
										<#organization type="select" id="gb"  name="gb"   organization="${organids! }" defaultCode="${customerService.gb!}"   class="easyui-combobox inputBox theme-textbox-radius" />
										</td>
										<%if(bbExp=='1'){%>
										<td style="width:8%;height: 30px;">
										<#organization type="select" id="bb"  name="bb"   organization="${organids! }" defaultCode="${customerService.bb!}"   class="easyui-combobox inputBox theme-textbox-radius" />
										</td>
										<%}%>
										<%if(kbExp=='1'){%>
										<td style="width:8%;height: 30px;">
										<#organization type="select" id="kb"  name="kb"   organization="${organids! }" defaultCode="${customerService.kb!}"   class="easyui-combobox inputBox theme-textbox-radius" />
										</td>
										<%}%>
										<%if(Exp=='1'){%>
										
										<td style="width:8%;height: 30px;">
										<#organization type="select" id="zfr"  name="zfr"   organization="${organids! }" defaultCode="${customerService.zfr!}"   class="easyui-combobox inputBox theme-textbox-radius" />
										</td>
									
										<td style="width:8%;height: 30px;">
										<#organization type="select" id="yfr"  name="yfr"   organization="${organids! }" defaultCode="${customerService.yfr!}"   class="easyui-combobox inputBox theme-textbox-radius" />
										</td>
										<%}%>
										<td >
										<input     type="text" value="${customerService.bz!}"   id="bz"   name="customerService.bz"        style="width: 90%;height: 30px;margin: 0px;padding: 0px;border-radius:3px;  border: 1px solid #ff7e00; "  >
										</td>
										</tr>
										<tr align="center">
										<td   colspan="11">
			
										<a href="#" class="easyui-linkbutton"  style="width:10%;height: 30px;font-weight: bold;border: 1px solid #9acd00;" onclick="deleterow()">保存</a>
										</td>
										</tr>
					</table>					
		</div>
		
		
		
		<script>
		
		$(document).ready(function () {
			
			var flag = $("#flag").val();
			if(flag=='1'){
				 parent.window.nodeClick("正在服务", "/beingServed");
			}
			
			
			$("#date_input").datebox({

				onChange: function (n,o) {

					$("#customerName").textbox("clear");
					$("#customerPhone").textbox("clear");
					$("#customerHybh").textbox("clear");
					
					$("#weight").val("");
					//$("#plasterCount").textbox('setValue',"1");
					/* $("#zc").html("");
					$("#dc").html(""); */
					$("#bz").textbox('setValue',"");
					searchCus();
				}

				});
			
			

		
			
			
			
			$("#customerName").combobox({

			onChange: function (n,o) {

				$("#customerPhone").textbox("clear");
				$("#customerHybh").textbox("clear");
				
				$("#weight").val("");
				//$("#plasterCount").textbox('setValue',"1");
				/* $("#zc").html("");
				$("#dc").html(""); */
				$("#bz").val("");
				searchCus();
			}

			});
			$("#customerPhone").combobox({

				onChange: function (n,o) {

					$("#customerName").textbox("clear");
					$("#customerHybh").textbox("clear");
					
					$("#weight").val("");
					//$("#plasterCount").textbox('setValue',"1");
					/* $("#zc").html("");
					$("#dc").html(""); */
					$("#bz").val("");
					searchCus();
				}

				});
			$("#customerHybh").combobox({

				onChange: function (n,o) {

					$("#customerName").textbox("clear");
					$("#customerPhone").textbox("clear");
					
					
					$("#weight").val("");
					/* $("#plasterCount").textbox('setValue',"1");
					$("#zc").html("");
					$("#dc").html(""); */
					$("#bz").val("");
					searchCus();
				}

				});
			
		
		});
		
		

		//清除筛选条件
		function clearsj(){
			$("#customerName").textbox("clear");
			$("#customerPhone").textbox("clear");
			$("#customerHybh").textbox("clear");
			$("#cpbh").textbox("clear");
			$('#cpbh').textbox('textbox').attr('readonly',false);
			
		}
		function searchCus(){
			var hybh=$('#customerHybh').val();
			var name=$('#customerName').val();
			var phone=$('#customerPhone').val();
			var date=$('#date_input').val();
			if(date==''){
				return false
			}
			if(hybh==''&&name==''&&phone==''){
				return false;
			}
			var url='/binShopColService/getCusByHybh';
			var data={"hybh":hybh,"name":name,"phone":phone,"temporary.gxsj":date};
			var reData = common_ajax.ajaxFunc(url,data,"json");
			if(reData.msg==200){
				$("#customerIds").val(reData.customer.ids);
				$("#customerName").textbox('setValue',reData.customer.name);
				$("#customerPhone").textbox('setValue',reData.customer.phone);
				$("#customerHybh").textbox('setValue',reData.customer.hybh);
				
				$("#sf").textbox('setValue',reData.customerService.sf);
				$("#yb").textbox('setValue',reData.customerService.yb);
				$("#dt").textbox('setValue',reData.customerService.dt);
				$("#xt").textbox('setValue',reData.customerService.xt);
				$("#gb").textbox('setValue',reData.customerService.gb);
				$("#bb").textbox('setValue',reData.customerService.bb);
				$("#kb").textbox('setValue',reData.customerService.kb);
				$("#zfr").textbox('setValue',reData.customerService.zfr);
				$("#yfr").textbox('setValue',reData.customerService.yfr);
				
				$("#weight").val(reData.customerService.weight);
				/* $("#plasterCount").textbox('setValue',reData.customerService.plastercount); */
				/* var tzc = (reData.customerService.weight-reData.customerService.lastweight).toFixed(2);
				
				if(tzc>0){
					$("#zc").html(tzc);
				}
				if(tzc<0){
					$("#dc").html(tzc*-1);
				} */
				$("#bz").val(reData.customerService.bz);
				
			}
				
		}


		
		
		
		function deleterow(){
			var date = $("#date_input").val()
			if($("#customerIds").val()==null||$("#customerIds").val()==''){
				$.alert(parent.$,"顾客不可为空！");
				return false;
			}
			if($("#weight").val()==null||$("#weight").val()==''){
					$.alert(parent.$,"体重不能为空！");
					return false;
			}
					var url = "${cxt!}/binShopColService/updateOrsaveSer";
					var data=$('#zxcsform').serialize();
					$.post(url,data, function(result) {
						if (result) {
							 $.slideMsg("保存成功", parent.$);
							
							parent.refresh();
							
						//	parent.window.nodeClick("服务", "/binShopColService/index?date="+date);
							
						} else {
							$.alert(parent.$,"保存失败或该顾客当天没有服务记录");
						}
					}, 'json');
		}
		
		
		
		
		
		
		
		
		
		
		
		
		
		
			
		
			
			
		
		
		
		
		
			$(document).ready(function () {
				var hybh=$('#customerHybh').val();
				var name=$('#customerName').val();
				var phone=$('#customerPhone').val();
				var url='/bentryRegister/getCusByHybh';
				var data={"hybh":hybh,"name":name,"phone":phone};
				var reData = common_ajax.ajaxFunc(url,data,"json");
				if(reData.msg==200){
					$("#customerIds").val(reData.customer.ids);
					$("#customerName").textbox('setValue',reData.customer.name);
					$("#customerPhone").textbox('setValue',reData.customer.phone);
					$("#customerHybh").textbox('setValue',reData.customer.hybh);
				}
			});
			function saveBz(customerid,sid){
				
				var bz=$("#"+customerid+"bz").val();
				if(bz!=null){
					var data={"bz":bz,"ids":sid};
					$.post('${cxt! }/beingServed/saveBz', data,function(result) {
						if(result.status == "200"){
							 $.slideMsg("保存成功", parent.$);
							 $dialog.dialog('destroy');
						}else{
						 $.slideMsg("保存失败", parent.$);
						}
					}, "json");
				}
				
				
			}
			function lookBz(customerid,sid){
				loadViewDialog( '客户产品', "${cxt!}/beingServed/lookBz?ids="+sid+"&yz=2",null,'600','350');
			}

			function loadDialog2(grid, tree, name, url, width, height) {
				if(!width){
					width = 920;
				}
				if(!height){
					height = $(window).height() * 0.9;
				}
				// 弹出窗口
			 	var dialog = parent.sy.modalDialog({
			 		iconCls: 'icon-save',
			        cls:'theme-panel-orange',
			 		title : name,
			 		url : url},width, height);
			}
		
		
		</script>
		</form>
	</body>
</html>

